#include<iostream>
using namespace std;
bool Leap(int n)
{
	if (n % 400 == 0 || n % 4 == 0 && n % 100 != 0) {
		return 1;
	}
	return 0;
}
int main()
{
	int x, y;
	cin >> x >> y;
	int count = 0;
	for (int i = x; i < y + 1; i++) {
		if (Leap(i)) {
			count++;
		}
	}
	cout << count << endl;
	for (int i = x; i < y + 1; i++) {
		if (Leap(i)) {
			cout << i << " ";
		}
	}
	return 0;
}